package com.study.blogsearchconsumer.controller;

import com.study.blogsearchconsumer.rabbitMQ.MqConsumer;
import com.study.blogsearchconsumer.rabbitMQ.MqProducer;
import com.study.blogsearchpojo.entity.Blog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("mq")
public class MQController {
    @Autowired
    MqProducer mqProducer;
    @Autowired
    MqConsumer mqConsumer;

    @RequestMapping("/yanaDirectExchange")

    public Void yanaDirectExchange() {
        Blog blog = new Blog();
        mqProducer.sendMsg("yanaDirectExchange","yanaDirect","yana is superStar");
        return null;
    }

    @RequestMapping("/yanaTopicExchange")
    public Void yanaTopicExchange() {
        mqProducer.sendMsg("yanaTopicExchange","yanaTopic#","yana is superStar");
        return null;
    }

    @RequestMapping("/yanaFanoutExchange")
    public Void yanaFanoutExchange() {
        mqProducer.sendMsg("yanaFanoutExchange","yanaFanout","yana is superStar");
        return null;
    }
}
//http://192.168.2.140:15672/#/